types of loop in sql